package sdk.service;

import java.util.Date;
import java.util.List;

import model.Dept;
import model.Duty;
import model.EduDegree;
import model.Education;
import model.Emp;
import model.EmpStatus;
import model.JobTitle;
import model.SkillGrade;
import util.Page;
import dao.EmpDAO;
import dao.impl.EmpDAOImpl;

public class EmpManager {
	EmpDAO ed = new EmpDAOImpl();
	 
	public boolean addEmp(int id,String name,String empno,String sex,String photo,String idCardid,String educationimg,Double salary,Date birthday,String address,String phone,Education education,
			EduDegree eduDegree,Duty duty,JobTitle jobTitle,EmpStatus empStatus,SkillGrade skillGrade,Dept dept) {
		Emp emp = new Emp();
		emp.setId(id);
		emp.setName(name);
		emp.setEmpno(empno);
		emp.setSex(sex);
		emp.setPhoto(photo);
		emp.setIdCardid(idCardid);
		emp.setEducationimg(educationimg);
		emp.setSalary(salary);
		emp.setBirthday(birthday);
		emp.setAddress(address);
		emp.setEducation(education);
		emp.setEduDegree(eduDegree);
		emp.setDuty(duty);
		emp.setJobTitle(jobTitle);
		emp.setEmpStatus(empStatus);
		emp.setSkillGrade(skillGrade);
		emp.setPhone(phone);
		return ed.addEmp(emp);
	}

	public boolean deleteByEmpId(int id) {
		
		return ed.deleteByEmpId(id);
	}

	public boolean deleteEmp(Emp emp) {
		
		return ed.deleteEmp(emp);
	}

	public Page<Emp> getAllEmp(int pageNo, int pageSize) {
		
		return ed.getAllEmp(pageNo, pageSize);
	}

	public Page<Emp> getEmpByDeptNo(int pageNo, int pageSize, int deptno) {
		
		return ed.getEmpByDeptNo(pageNo, pageSize, deptno);
	}

	public Page<Emp> getEmpByEduDegree(int pageNo, int pageSize,
			EduDegree degree) {
		// TODO Auto-generated method stub
		return ed.getEmpByEduDegree(pageNo, pageSize, degree);
	}

	public Page<Emp> getEmpByEducation(int pageNo, int pageSize, Education edu) {
		// TODO Auto-generated method stub
		return ed.getEmpByEducation(pageNo, pageSize, edu);
	}

	public List<Emp> getEmpByEmpName(String name) {
		
		return ed.getEmpByEmpName(name);
	}

	public Emp getById(int id)
	{
		return ed.getEmpById(id);
	}

	public Page<Emp> getEmpByJobTitle(int pageNo, int pageSize,
			JobTitle jobTitle) {
		
		return ed.getEmpByJobTitle(pageNo, pageSize, jobTitle);
	}

	public Page<Emp> getEmpBySex(int pageNo, int pageSize, String sex) {
		// TODO Auto-generated method stub
		return ed.getEmpBySex(pageNo, pageSize, sex);
	}

	public Page<Emp> getEmpBySkillGrade(int pageNo, int pageSize,
			SkillGrade skillGrade) {
		
		return ed.getEmpBySkillGrade(pageNo, pageSize, skillGrade);
	}


	public boolean updateEmp(Emp emp) {
		
		return ed.addEmp(emp);
	}


}
